<?php

/**
 * Created by PhpStorm.
 * User: qiliping
 * Date: 2016/12/20
 * Time: 下午3:15
 */
class Syswxconfig_model extends CI_Model
{
    function update_verify_ticket($create_time,$verify_ticket,$info_type){
        $data = array(
            'component_verify_ticket' => $verify_ticket,
            'create_time' => $create_time,
            'info_type' => $info_type,
        );
        $where = 'id = 0';
//        print_r($where);
        $this->db->update('sys_wx_config', $data, $where);
    }

    function get_wxconfig(){
        $sql = "select * from {$this->db->dbprefix}sys_wx_config where id=0 LIMIT 1";
        return $this->db->query($sql)->row_array();
    }

    function update_token($token){
        $data = array(
            'component_access_token' => $token,
            'create_time' => time(),
            'expires_in' => 7200,
        );
        $where = 'id = 0';

        $this->db->update('sys_wx_config', $data, $where);
    }
}